<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="style.css">
    <title>输入框交互</title>
    <style>
        .app {
            width: 100%;
            height: 100vh;
            background-color: #ffffff;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .label28 {
            width: 190px;
            height: 68px;
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            cursor: text;
        }

        .span28 {
            width: 100%;
            color: #000;
            font-size: 14px;
            margin-bottom: 6px;
            padding: 0 10px;
        }

        .inp28 {
            width: 100%;
            padding: 0 10px;
            height: 2px;
            border: 0;
            font-size: 14px;
            box-sizing: border-box;
            background-color: rgba(0, 0, 0, 0.1);
            transition: .3s;
        }

        .inp28:hover {
            background-color: rgba(50, 133, 255, 0.7);
        }

        .inp28:focus,
        .inp28:valid {
            background-color: rgba(50, 133, 255, 0.2);
            border: 2px solid rgba(50, 133, 255, 0.7);
            border-radius: 4px;
            height: 42px;
            color: #000;
        }
    </style>
</head>

<body>
    <div class="app">
        <label class="label28">
            <span class="span28">用户名</span>
            <input class="inp28" type="text" required>
        </label>
    </div>
</body>

</html>